#!/bin/bash

SCRIPTS_DIR=`dirname $0`

src="$1"
dst="$2"
width="$3"
height="$4"

if [ -z "$src" -o -z "$dst" -o -z "$width" ]; then
    echo "$0 SRC-SVG DST-PNG WIDTH [HEIGHT]" >&2
    exit 1
fi

if [ -z "$height" ]; then
    height="$width"
fi

"$SCRIPTS_DIR"/inkscape \
    --without-gui \
    --export-png="$dst" \
    --export-width="$width" \
    --export-height="$height" \
    "$src"
